using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
/*
编码和纠错
压缩与冗余
压缩算法
    1.哈夫曼树
    2.LZW字典
    3.算数编码
有损压缩与无损压缩
LZW 串表压缩算法
 */
namespace ZHello.Algorithm.LZW
{
    public class LZW
    {
        public char[] BasicChars;
        private static DiyDictionary<string, int> BasicDic;
        private static DiyDictionary<string, int> Dic = new DiyDictionary<string, int>(100);

        static LZW()
        {
            BasicDic = new DiyDictionary<string, int>(100);
            for (int i = ' '; i <= '~'; i++)
            {
                BasicDic.Add(((char)i).ToString(), i);
                Dic.Add(((char)i).ToString(), i);
            }
        }

        public static string LZWCompress(string str)
        {
            if (string.IsNullOrEmpty(str))
                return null;
            var ret = new StringBuilder(str.Length);
            for (int i = 0; i < str.Length; i++)
            {
                if (Dic.ContainsKey(str[i].ToString()))
                {

                }
            }
            return ret.ToString();
        }

        public static string LZWDecompress(string str)
        {
            var ret = string.Empty;


            return ret;
        }
    }
}

